#include <iostream>
using namespace std;

class CRAFT
{
    protected:
       float speed;
    public:
      CRAFT(float speed)
      {
          cout<<"CRAFT constructor"<<endl;
          this->speed = speed;
      }
    ~CRAFT()
    {
        cout<<"CRAFT distructor"<<endl;   
    }
    void Show()
    {
        cout<<"fly (speed: "<<speed<<")"<<endl;
    }
};
class PLANE: public CRAFT
{
     protected:
         int width;
     public:
         PLANE(float speed, float width):CRAFT(speed)
         {
           
            this->width = width;
            cout<<"PLANE constructor"<<endl;
          }
          ~PLANE()
          {
              cout<<"PLANE distructor"<<endl;
          }
          void Show()
          {
              cout<<"fly (speed: "<<speed<< ", width: "<< width<<")\n";
          }
};

class SHIP: public CRAFT
{
     protected:
         float depth;
     public:
          SHIP(float speed, float depth):CRAFT(speed)
         {
           
            this->depth=depth;
            cout<<"SHIP constructor"<<endl;
          }
          ~SHIP()
          {
              cout<<"SHIP distructor"<<endl;
          }
          void Show()
          {
              cout<<"fly (speed: "<<speed<< ",depth: "<<depth<<")\n";
          }
};

class SEAPLANE: public PLANE, public  SHIP 
{
     protected:
         float depth;
     public:
           SEAPLANE(float speed, float width, float depth): PLANE(speed, width),SHIP(speed, depth)
         {
            cout<<" SEAPLANE constructor"<<endl;
          }
          ~ SEAPLANE()
          {
              cout<<" SEAPLANE distructor"<<endl;
          }
          void Show()
          {
              //cout<<"fly (speed: "<<speed<< ",depth: "<<depth<<", width:"<<width<<")\n";
              cout<<"fly (speed: "<<SHIP::speed << ",depth: "<<depth<<", width:"<<width<<")\n";
          }
};
int main()
{
    CRAFT * pc = new CRAFT(1000);
    pc->Show();
    //delete pc;
   
   
   cout<<string(10,'*')<<endl;
   PLANE * pp = new PLANE(1000,10);
   pp->Show();
   //delete pp;
   
   cout<<string(10,'*')<<endl;
    SHIP*ps = new SHIP(45.8, 8.3);
    ps->Show();
    //delete ps;

   cout<<string(10,'*')<<endl;
    SEAPLANE *psp;
    psp = new SEAPLANE(415.2, 36.5, 2.1);
    psp->Show();
    //delete psp;


   cout<<string(10,'+')<<endl;
    CRAFT * all[4];
    all[0] =(CRAFT *) pc; 
    all[1] = (CRAFT *)pp; 
    all[2] = (CRAFT *)ps; 
    //all[3] = (CRAFT *)psp; 
    for(int i = 0; i<3; i++)
        all[i]->Show();
}